Python requestsでScrapbox APIのStreamを叩く
1
code:py
# encoding: utf-8
import json
import os
import requests
def str2file(filepath, s):
with open(filepath, encoding='utf8', mode='w') as f:
f.write(s)
params = {}
proxies = {}
headers = {}
r = requests.get(url, proxies=proxies, verify=False, headers=headers, params=params)
obj = r.json()
option_jsondump = {
'ensure_ascii' : False,
'indent' : 4,
}
outstr = json.dumps(obj, **option_jsondump)
str2file('sta.json', outstr)
そうか、データ構造はもうまとめてあるのか
と思ったけど、ちょっと違う
eventsはなさそうだが
code:json
{
"projectName": "sta",
"end": 1630228190,
"pages": [
{
"id": "612859092f240a001db7f44d",
"title": "セルフモニタリング(指ヒリ)",
"lines": [
{
"id": "612859092f240a001db7f44d",
"text": "セルフモニタリング(指ヒリ)",
"userId": "5a4873ab2e26fb001479d3a9",
"created": 1630034189,
"updated": 1630034189
},
……
],
"iconsLc": []
},
1630228190
unixtime
2021-08-29 18:09:50